<template>
    <div class="shop" style="background: #f3f3f3">
        <div class="base_header">
            <img @click="goBack()" class="back" src="../../assets/img/back.png" alt="">商品分类
        </div>
        <ul class="classify_list vertical-list">
            <router-link :to="{path:'/item_classify'}">
                <li>
                    全部商品 <img class="fr" src="../../assets/img/goods/arrow.png" alt="">
                </li>
            </router-link>

            <li v-for="category in shopCategories">
                <router-link :to="{path:'/item_classify',query:{category_id:category.tCategoryId,shopId:shopId}}">
                    {{category.sCategoryName}}/{{category.tCategoryName}} <img class="fr" src="../../assets/img/goods/arrow.png" alt="">
                </router-link>
            </li>
        </ul>
    </div>
</template>

<style>
    @import url("./shop.css");
</style>
<script>
    import {Toast} from 'mint-ui';
    import API from '../../assets/js/API'
    import Layer from '../../assets/js/MessageBox'

    export default {
        data() {
            return {
                shopId: this.$route.query.shopId,
                shopCategories: []
            }
        },
        created() {
             window.scrollTo(0,0);
            let url = API.serviceDomain + API.shopCategory + "/" + this.shopId;
            this.$http.get(url).then(
                (res) => {
                    if (res.body.status == '000000') {
                        this.shopCategories = res.body.data;
                        console.log(this.shopCategories);
                    } else {
                        Layer.showMsg(res.body.message);
                    }
                },
                (error) => {
                    Layer.showMsg("服务器开小差了...")
                    return
                }
            )
        },
        mounted() {
        },
        methods: {
            goBack() {
                this.$router.goBack()
            }
        }
    }
</script>
